import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { TCampTreasure } from "../../../Message/Db/Tables/TCampTreasure";
import { StringHelper } from "../../../com/gengine/utils/StringHelper";
import { Game } from "../Game";
type int = number;
//class NationalTreasureConfig
    
    export  class NationalTreasureConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            this._planToCamp = new Map<any, any> /* flash.utils.Dictionary */();
            this._bossRefreshInfoToCamp = new Map<any, any> /* flash.utils.Dictionary */();
            if (NationalTreasureConfig._instance) 
            {
                throw new Error("NationalTreasureConfig is a single!");
            }
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_camp_treasure.json");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new TCampTreasure();
                loc1.bossNum = loc2.bossNum;
                loc1.camp = loc2.camp;
                loc1.map = loc2.map;
                loc1.plan = loc2.plan;
                loc1.x1 = int(StringHelper.getString(loc2.x1));
                loc1.x2 = int(StringHelper.getString(loc2.x2));
                loc1.x3 = int(StringHelper.getString(loc2.x3));
                loc1.y1 = int(StringHelper.getString(loc2.y1));
                loc1.y2 = int(StringHelper.getString(loc2.y2));
                loc1.y3 = int(StringHelper.getString(loc2.y3));
                this._map[loc1.camp] = loc1;
                this._planToCamp[loc1.camp] = loc1.plan.split("#");
            }
            return;
        }

        public getInfoByCamp(arg1: int): TCampTreasure
        {
            return this._map[arg1];
        }

        public getBossRefreshPlanByCamp(arg1: int): Array<any>
        {
            return this._planToCamp[arg1];
        }

        public isNationalTreaByPlan(arg1: int, arg2: int): Boolean
        {
            var loc1=this.getBossRefreshPlanByCamp(arg2);
            if (loc1 && loc1.length > 0) 
            {
                return !(loc1.indexOf(arg1 + "") == -1);
            }
            return false;
        }

        public getBossRefreshInfoByCamp(arg1: int): Array<any>
        {
            var loc3=null;
            if (this._bossRefreshInfoToCamp.hasOwnProperty(arg1)) 
            {
                return this._bossRefreshInfoToCamp[arg1];
            }
            var loc1=this.getBossRefreshPlanByCamp(arg1);
            var loc2=[];
            var loc4=0;
            var loc5=loc1;
            for(loc3 of loc5) 
            {
                loc2 = loc2.concat(Game.sceneInfo.getBossRefreshInfoByPlan(int(loc3)));
            }
            this._bossRefreshInfoToCamp[arg1] = loc2;
            return loc2;
        }

        public static get instance(): NationalTreasureConfig
        {
            if (!NationalTreasureConfig._instance) 
            {
                NationalTreasureConfig._instance = new NationalTreasureConfig();
            }
            return NationalTreasureConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_planToCamp: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_bossRefreshInfoToCamp: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: NationalTreasureConfig;
    }
